#include<reg51.h>
 #include<stdio.h>


sbit RF_A=P0^4;
sbit RF_B=P0^5;
sbit RF_C=P0^6;
sbit RF_D=P0^7;
 
void InitSerial(void)
{
  	SCON = 0x52;    // setup serial port control 
  	TMOD = 0x20;    // hardware (1200 BAUD @11.05592MHZ) 
  	TH1  = 0xFD;    // TH1 1200 Baud
	TR1	 = 1;  		// Timer 1 on
}
void LCD_delay(unsigned char ms)
{
	unsigned int n;
	unsigned int i;
	for (n=0; n<ms; n++)
	{
		for (i=0; i<1535; i++); /* For 1 ms */
	}
    
}
void tx(unsigned char a)
{
      	SBUF = a;
		 	while(TI == 0);
			TI = 0;
}

void main()
 {
 unsigned char dummy=0;
 InitSerial();
 P1=0xff;
 P2=0x00;

         tx('A');
   LCD_delay(100);

while(1)
{
      	while(RI == 0);        	
      		dummy=SBUF;
      			if(dummy=='F')
      			{ 
      					RF_A=0;R
							RF_B=1;
							RF_C=1;
							RF_D=1;
      			}
      			else if(dummy=='B')
      			{ 
      					RF_A=1;
							RF_B=0;
							RF_C=1;
							RF_D=1;
      			}
      			else if(dummy=='R')
      			{ 
      					RF_A=1;
							RF_B=1;
							RF_C=0;
							RF_D=1;
      			}
      			else if(dummy=='L')
      			{ 
      					RF_A=1;
							RF_B=1;
							RF_C=1;
							RF_D=0;
      			}
      			else if(dummy=='S')
      			{ 
      					RF_A=0;S
							RF_B=0;
							RF_C=1;
							RF_D=1;
      			}    
      			RI=0;
}
}

